#include <stdio.h>
#include <libxml/parser.h>
#include <libxml/tree.h>

struct play_data_send
{
  char* mediatype;
  char * location;
  char* playtime;
  char* insertmode;

};
int main(int argc, char **argv)

{
  struct play_data_send data[2]={{"0","./program/3.jpg","5","1"},{"1","./program/4.jpg","5","1"}};
  xmlDocPtr doc = NULL;
  xmlNodePtr root_node = NULL, node = NULL;
  doc = xmlNewDoc(BAD_CAST "1.0");
  root_node = xmlNewNode(NULL, BAD_CAST "root");
  xmlDocSetRootElement(doc, root_node);
  int i;
    node=xmlNewChild(root_node, NULL, BAD_CAST "node",BAD_CAST"INSERT");
    node=xmlNewChild(root_node, NULL, BAD_CAST "node",BAD_CAST"2");
  for(i=0;i<2;i++)
  {
    node=xmlNewChild(root_node, NULL, BAD_CAST "node",BAD_CAST"node has attributes");
    xmlNewProp(node, BAD_CAST "mediatype", BAD_CAST data[i].mediatype);
    xmlNewProp(node, BAD_CAST "location", BAD_CAST data[i].location);
    xmlNewProp(node, BAD_CAST "playtime", BAD_CAST data[i].playtime);
    xmlNewProp(node, BAD_CAST "insertmode",BAD_CAST data[i].insertmode);
  }

  xmlSaveFile ("2.xml",doc);

  xmlFreeDoc(doc);
  xmlCleanupParser();
  xmlMemoryDump();   
  return(0);

}
